package com.google.android.gms.internal;

import android.annotation.TargetApi;
import android.content.Context;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.NotificationCompat;
import android.support.v4.view.ViewCompat;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import android.webkit.SslErrorHandler;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.google.android.exoplayer2.extractor.ts.TsExtractor;
import com.google.android.gms.ads.internal.gmsg.zza;
import com.google.android.gms.ads.internal.gmsg.zzaa;
import com.google.android.gms.ads.internal.gmsg.zzab;
import com.google.android.gms.ads.internal.gmsg.zzb;
import com.google.android.gms.ads.internal.gmsg.zzd;
import com.google.android.gms.ads.internal.gmsg.zzx;
import com.google.android.gms.ads.internal.gmsg.zzz;
import com.google.android.gms.ads.internal.overlay.AdOverlayInfoParcel;
import com.google.android.gms.ads.internal.overlay.zzc;
import com.google.android.gms.ads.internal.overlay.zzl;
import com.google.android.gms.ads.internal.overlay.zzn;
import com.google.android.gms.ads.internal.overlay.zzt;
import com.google.android.gms.ads.internal.zzbt;
import com.google.android.gms.ads.internal.zzw;
import com.google.android.gms.common.internal.Hide;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;

@Hide
@zzabh
public class zzaog extends WebViewClient implements zzapu {
    private static final String[] zzdpb = {"UNKNOWN", "HOST_LOOKUP", "UNSUPPORTED_AUTH_SCHEME", "AUTHENTICATION", "PROXY_AUTHENTICATION", "CONNECT", "IO", "TIMEOUT", "REDIRECT_LOOP", "UNSUPPORTED_SCHEME", "FAILED_SSL_HANDSHAKE", "BAD_URL", "FILE", "FILE_NOT_FOUND", "TOO_MANY_REQUESTS"};
    private static final String[] zzdpc = {"NOT_YET_VALID", "EXPIRED", "ID_MISMATCH", "UNTRUSTED", "DATE_INVALID", "INVALID"};
    private final Object mLock;
    @Nullable
    protected zzagq zzaop;
    private boolean zzavq;
    private zzkf zzbgt;
    private zzb zzcbc;
    private zzx zzcck;
    private zzw zzccm;
    private zzyd zzccn;
    private zzyo zzcco;
    private zzt zzccr;
    private zzn zzccs;
    private zzaof zzcct;
    private final HashMap<String, List<com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>>> zzcou;
    private zzapv zzdpd;
    private zzapw zzdpe;
    private zzapx zzdpf;
    private boolean zzdpg;
    private boolean zzdph;
    private ViewTreeObserver.OnGlobalLayoutListener zzdpi;
    private ViewTreeObserver.OnScrollChangedListener zzdpj;
    private boolean zzdpk;
    private final zzym zzdpl;
    private zzapy zzdpm;
    private boolean zzdpn;
    private boolean zzdpo;
    private int zzdpp;
    private View.OnAttachStateChangeListener zzdpq;

    public zzaog(zzaof zzaof, boolean z) {
        this(zzaof, z, new zzym(zzaof, zzaof.zztv(), new zznu(zzaof.getContext())), (zzyd) null);
    }

    private zzaog(zzaof zzaof, boolean z, zzym zzym, zzyd zzyd) {
        this.zzcou = new HashMap<>();
        this.mLock = new Object();
        this.zzdpg = false;
        this.zzcct = zzaof;
        this.zzavq = z;
        this.zzdpl = zzym;
        this.zzccn = null;
    }

    /* access modifiers changed from: private */
    public final void zza(View view, zzagq zzagq, int i) {
        if (zzagq.zzpf() && i > 0) {
            zzagq.zzq(view);
            if (zzagq.zzpf()) {
                zzaij.zzdfn.postDelayed(new zzaoi(this, view, zzagq, i), 100);
            }
        }
    }

    private final void zza(AdOverlayInfoParcel adOverlayInfoParcel) {
        boolean z = false;
        boolean zznf = this.zzccn != null ? this.zzccn.zznf() : false;
        zzbt.zzej();
        Context context = this.zzcct.getContext();
        if (!zznf) {
            z = true;
        }
        zzl.zza(context, adOverlayInfoParcel, z);
        if (this.zzaop != null) {
            String str = adOverlayInfoParcel.url;
            if (str == null && adOverlayInfoParcel.zzcnj != null) {
                str = adOverlayInfoParcel.zzcnj.url;
            }
            this.zzaop.zzbv(str);
        }
    }

    private final void zzd(Context context, String str, String str2, String str3) {
        String str4;
        if (((Boolean) zzlc.zzio().zzd(zzoi.zzbqr)).booleanValue()) {
            Bundle bundle = new Bundle();
            bundle.putString(NotificationCompat.CATEGORY_ERROR, str);
            bundle.putString("code", str2);
            if (!TextUtils.isEmpty(str3)) {
                Uri parse = Uri.parse(str3);
                if (parse.getHost() != null) {
                    str4 = parse.getHost();
                    bundle.putString("host", str4);
                    zzbt.zzel().zza(context, this.zzcct.zztl().zzcu, "gmob-apps", bundle, true);
                }
            }
            str4 = "";
            bundle.putString("host", str4);
            zzbt.zzel().zza(context, this.zzcct.zztl().zzcu, "gmob-apps", bundle, true);
        }
    }

    private final WebResourceResponse zzdf(String str) throws IOException {
        HttpURLConnection httpURLConnection;
        String zzcn;
        String zzco;
        URL url = new URL(str);
        int i = 0;
        while (true) {
            i++;
            if (i <= 20) {
                URLConnection openConnection = url.openConnection();
                openConnection.setConnectTimeout(10000);
                openConnection.setReadTimeout(10000);
                if (!(openConnection instanceof HttpURLConnection)) {
                    throw new IOException("Invalid protocol.");
                }
                httpURLConnection = (HttpURLConnection) openConnection;
                zzbt.zzel().zza(this.zzcct.getContext(), this.zzcct.zztl().zzcu, false, httpURLConnection);
                zzaks zzaks = new zzaks();
                zzaks.zza(httpURLConnection, (byte[]) null);
                int responseCode = httpURLConnection.getResponseCode();
                zzbt.zzel();
                zzcn = zzaij.zzcn(httpURLConnection.getContentType());
                zzbt.zzel();
                zzco = zzaij.zzco(httpURLConnection.getContentType());
                zzaks.zza(httpURLConnection, responseCode);
                if (responseCode >= 300 && responseCode < 400) {
                    String headerField = httpURLConnection.getHeaderField("Location");
                    if (headerField == null) {
                        throw new IOException("Missing Location header in redirect");
                    }
                    URL url2 = new URL(url, headerField);
                    String protocol = url2.getProtocol();
                    if (protocol == null) {
                        zzahw.zzcz("Protocol is null");
                        return null;
                    } else if (protocol.equals("http") || protocol.equals("https")) {
                        String valueOf = String.valueOf(headerField);
                        zzahw.zzby(valueOf.length() != 0 ? "Redirecting to ".concat(valueOf) : new String("Redirecting to "));
                        httpURLConnection.disconnect();
                        url = url2;
                    } else {
                        String valueOf2 = String.valueOf(protocol);
                        zzahw.zzcz(valueOf2.length() != 0 ? "Unsupported scheme: ".concat(valueOf2) : new String("Unsupported scheme: "));
                        return null;
                    }
                }
            } else {
                StringBuilder sb = new StringBuilder(32);
                sb.append("Too many redirects (20)");
                throw new IOException(sb.toString());
            }
        }
        return new WebResourceResponse(zzcn, zzco, httpURLConnection.getInputStream());
    }

    private final void zzh(Uri uri) {
        String path = uri.getPath();
        List<com.google.android.gms.ads.internal.gmsg.zzt> list = this.zzcou.get(path);
        if (list != null) {
            zzbt.zzel();
            Map<String, String> zzf = zzaij.zzf(uri);
            if (zzahw.zzae(2)) {
                String valueOf = String.valueOf(path);
                zzahw.v(valueOf.length() != 0 ? "Received GMSG: ".concat(valueOf) : new String("Received GMSG: "));
                for (String next : zzf.keySet()) {
                    String str = zzf.get(next);
                    StringBuilder sb = new StringBuilder(4 + String.valueOf(next).length() + String.valueOf(str).length());
                    sb.append("  ");
                    sb.append(next);
                    sb.append(": ");
                    sb.append(str);
                    zzahw.v(sb.toString());
                }
            }
            for (com.google.android.gms.ads.internal.gmsg.zzt zza : list) {
                zza.zza(this.zzcct, zzf);
            }
            return;
        }
        String valueOf2 = String.valueOf(uri);
        StringBuilder sb2 = new StringBuilder(32 + String.valueOf(valueOf2).length());
        sb2.append("No GMSG handler found for GMSG: ");
        sb2.append(valueOf2);
        zzahw.v(sb2.toString());
    }

    private final void zzus() {
        if (this.zzdpq != null) {
            this.zzcct.getView().removeOnAttachStateChangeListener(this.zzdpq);
        }
    }

    private final void zzux() {
        if (this.zzdpd != null && ((this.zzdpn && this.zzdpp <= 0) || this.zzdpo)) {
            this.zzdpd.zza(this.zzcct, !this.zzdpo);
            this.zzdpd = null;
        }
        this.zzcct.zzuj();
    }

    public final void onLoadResource(WebView webView, String str) {
        String valueOf = String.valueOf(str);
        zzahw.v(valueOf.length() != 0 ? "Loading resource: ".concat(valueOf) : new String("Loading resource: "));
        Uri parse = Uri.parse(str);
        if ("gmsg".equalsIgnoreCase(parse.getScheme()) && "mobileads.google.com".equalsIgnoreCase(parse.getHost())) {
            zzh(parse);
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:10:0x001d, code lost:
        if (r0.zzdpe == null) goto L_0x0029;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:11:0x001f, code lost:
        r0.zzdpe.zzf(r0.zzcct);
        r0.zzdpe = null;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:12:0x0029, code lost:
        zzux();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:13:0x002c, code lost:
        return;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:9:0x0018, code lost:
        r0.zzdpn = true;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void onPageFinished(android.webkit.WebView r1, java.lang.String r2) {
        /*
            r0 = this;
            java.lang.Object r1 = r0.mLock
            monitor-enter(r1)
            com.google.android.gms.internal.zzaof r2 = r0.zzcct     // Catch:{ all -> 0x002d }
            boolean r2 = r2.isDestroyed()     // Catch:{ all -> 0x002d }
            if (r2 == 0) goto L_0x0017
            java.lang.String r2 = "Blank page loaded, 1..."
            com.google.android.gms.internal.zzahw.v(r2)     // Catch:{ all -> 0x002d }
            com.google.android.gms.internal.zzaof r2 = r0.zzcct     // Catch:{ all -> 0x002d }
            r2.zzue()     // Catch:{ all -> 0x002d }
            monitor-exit(r1)     // Catch:{ all -> 0x002d }
            return
        L_0x0017:
            monitor-exit(r1)     // Catch:{ all -> 0x002d }
            r1 = 1
            r0.zzdpn = r1
            com.google.android.gms.internal.zzapw r1 = r0.zzdpe
            if (r1 == 0) goto L_0x0029
            com.google.android.gms.internal.zzapw r1 = r0.zzdpe
            com.google.android.gms.internal.zzaof r2 = r0.zzcct
            r1.zzf(r2)
            r1 = 0
            r0.zzdpe = r1
        L_0x0029:
            r0.zzux()
            return
        L_0x002d:
            r2 = move-exception
            monitor-exit(r1)     // Catch:{ all -> 0x002d }
            throw r2
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzaog.onPageFinished(android.webkit.WebView, java.lang.String):void");
    }

    /* JADX WARNING: Code restructure failed: missing block: B:1:0x0002, code lost:
        r0 = (-r5) - 1;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void onReceivedError(android.webkit.WebView r4, int r5, java.lang.String r6, java.lang.String r7) {
        /*
            r3 = this;
            if (r5 >= 0) goto L_0x000f
            int r0 = -r5
            int r0 = r0 + -1
            java.lang.String[] r1 = zzdpb
            int r1 = r1.length
            if (r0 >= r1) goto L_0x000f
            java.lang.String[] r1 = zzdpb
            r0 = r1[r0]
            goto L_0x0013
        L_0x000f:
            java.lang.String r0 = java.lang.String.valueOf(r5)
        L_0x0013:
            com.google.android.gms.internal.zzaof r1 = r3.zzcct
            android.content.Context r1 = r1.getContext()
            java.lang.String r2 = "http_err"
            r3.zzd(r1, r2, r0, r7)
            super.onReceivedError(r4, r5, r6, r7)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzaog.onReceivedError(android.webkit.WebView, int, java.lang.String, java.lang.String):void");
    }

    public final void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
        if (sslError != null) {
            int primaryError = sslError.getPrimaryError();
            zzd(this.zzcct.getContext(), "ssl_err", (primaryError < 0 || primaryError >= zzdpc.length) ? String.valueOf(primaryError) : zzdpc[primaryError], zzbt.zzen().zza(sslError));
        }
        super.onReceivedSslError(webView, sslErrorHandler, sslError);
    }

    public final void reset() {
        if (this.zzaop != null) {
            this.zzaop.zzph();
            this.zzaop = null;
        }
        zzus();
        synchronized (this.mLock) {
            this.zzcou.clear();
            this.zzbgt = null;
            this.zzccs = null;
            this.zzdpd = null;
            this.zzdpe = null;
            this.zzcbc = null;
            this.zzdpg = false;
            this.zzavq = false;
            this.zzdph = false;
            this.zzdpk = false;
            this.zzccr = null;
            this.zzdpf = null;
            if (this.zzccn != null) {
                this.zzccn.zzm(true);
                this.zzccn = null;
            }
        }
    }

    @TargetApi(11)
    public WebResourceResponse shouldInterceptRequest(WebView webView, String str) {
        zzik zza;
        try {
            String zzb = zzagx.zzb(str, this.zzcct.getContext());
            if (!zzb.equals(str)) {
                return zzdf(zzb);
            }
            zzin zzab = zzin.zzab(str);
            if (zzab != null && (zza = zzbt.zzer().zza(zzab)) != null && zza.zzhj()) {
                return new WebResourceResponse("", "", zza.zzhk());
            }
            if (zzaks.isEnabled()) {
                if (((Boolean) zzlc.zzio().zzd(zzoi.zzbqg)).booleanValue()) {
                    return zzdf(str);
                }
            }
            return null;
        } catch (Exception | NoClassDefFoundError e) {
            zzbt.zzep().zza(e, "AdWebViewClient.interceptRequest");
            return null;
        }
    }

    public boolean shouldOverrideKeyEvent(WebView webView, KeyEvent keyEvent) {
        int keyCode = keyEvent.getKeyCode();
        if (keyCode == 79 || keyCode == 222) {
            return true;
        }
        switch (keyCode) {
            case 85:
            case 86:
            case 87:
            case 88:
            case 89:
            case 90:
            case 91:
                return true;
            default:
                switch (keyCode) {
                    case 126:
                    case 127:
                    case 128:
                    case TsExtractor.TS_STREAM_TYPE_AC3:
                    case TsExtractor.TS_STREAM_TYPE_HDMV_DTS:
                        return true;
                    default:
                        return false;
                }
        }
    }

    public final boolean shouldOverrideUrlLoading(WebView webView, String str) {
        String valueOf = String.valueOf(str);
        zzahw.v(valueOf.length() != 0 ? "AdWebView shouldOverrideUrlLoading: ".concat(valueOf) : new String("AdWebView shouldOverrideUrlLoading: "));
        Uri parse = Uri.parse(str);
        if (!"gmsg".equalsIgnoreCase(parse.getScheme()) || !"mobileads.google.com".equalsIgnoreCase(parse.getHost())) {
            if (this.zzdpg && webView == this.zzcct.getWebView()) {
                String scheme = parse.getScheme();
                if ("http".equalsIgnoreCase(scheme) || "https".equalsIgnoreCase(scheme)) {
                    if (this.zzbgt != null) {
                        if (((Boolean) zzlc.zzio().zzd(zzoi.zzboc)).booleanValue()) {
                            this.zzbgt.onAdClicked();
                            if (this.zzaop != null) {
                                this.zzaop.zzbv(str);
                            }
                            this.zzbgt = null;
                        }
                    }
                    return super.shouldOverrideUrlLoading(webView, str);
                }
            }
            if (!this.zzcct.getWebView().willNotDraw()) {
                try {
                    zzcv zzuc = this.zzcct.zzuc();
                    if (zzuc != null && zzuc.zzb(parse)) {
                        parse = zzuc.zza(parse, this.zzcct.getContext(), this.zzcct.getView(), this.zzcct.zztj());
                    }
                } catch (zzcw unused) {
                    String valueOf2 = String.valueOf(str);
                    zzahw.zzcz(valueOf2.length() != 0 ? "Unable to append parameter to URL: ".concat(valueOf2) : new String("Unable to append parameter to URL: "));
                }
                if (this.zzccm == null || this.zzccm.zzcz()) {
                    zza(new zzc("android.intent.action.VIEW", parse.toString(), (String) null, (String) null, (String) null, (String) null, (String) null));
                    return true;
                }
                this.zzccm.zzt(str);
                return true;
            }
            String valueOf3 = String.valueOf(str);
            zzahw.zzcz(valueOf3.length() != 0 ? "AdWebView unable to handle URL: ".concat(valueOf3) : new String("AdWebView unable to handle URL: "));
            return true;
        }
        zzh(parse);
        return true;
    }

    public final void zza(int i, int i2, boolean z) {
        this.zzdpl.zzc(i, i2);
        if (this.zzccn != null) {
            this.zzccn.zza(i, i2, z);
        }
    }

    public final void zza(ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener, ViewTreeObserver.OnScrollChangedListener onScrollChangedListener) {
        synchronized (this.mLock) {
            this.zzdph = true;
            this.zzcct.zzui();
            this.zzdpi = onGlobalLayoutListener;
            this.zzdpj = onScrollChangedListener;
        }
    }

    public final void zza(zzc zzc) {
        boolean zzud = this.zzcct.zzud();
        zza(new AdOverlayInfoParcel(zzc, (!zzud || this.zzcct.zzty().zzvl()) ? this.zzbgt : null, zzud ? null : this.zzccs, this.zzccr, this.zzcct.zztl()));
    }

    public final void zza(zzapv zzapv) {
        this.zzdpd = zzapv;
    }

    public final void zza(zzapw zzapw) {
        this.zzdpe = zzapw;
    }

    public final void zza(zzapx zzapx) {
        this.zzdpf = zzapx;
    }

    public final void zza(zzapy zzapy) {
        this.zzdpm = zzapy;
    }

    public final void zza(zzkf zzkf, zzn zzn, zzb zzb, zzt zzt, boolean z, @Nullable zzx zzx, zzw zzw, zzyo zzyo, @Nullable zzagq zzagq) {
        zzb zzb2 = zzb;
        zzx zzx2 = zzx;
        zzyo zzyo2 = zzyo;
        zzagq zzagq2 = zzagq;
        zzw zzw2 = zzw == null ? new zzw(this.zzcct.getContext(), zzagq2, (zzacl) null) : zzw;
        this.zzccn = new zzyd(this.zzcct, zzyo2);
        this.zzaop = zzagq2;
        zza("/appEvent", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) new zza(zzb2));
        zza("/backButton", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzd.zzcbn);
        zza("/refresh", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzd.zzcbo);
        zza("/canOpenURLs", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzd.zzcbe);
        zza("/canOpenIntents", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzd.zzcbf);
        zza("/click", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzd.zzcbg);
        zza("/close", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzd.zzcbh);
        zza("/customClose", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzd.zzcbi);
        zza("/instrument", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzd.zzcbr);
        zza("/delayPageLoaded", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzd.zzcbt);
        zza("/delayPageClosed", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzd.zzcbu);
        zza("/getLocationInfo", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzd.zzcbv);
        zza("/httpTrack", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzd.zzcbj);
        zza("/log", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzd.zzcbk);
        zza("/mraid", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) new zzaa(zzw2, this.zzccn, zzyo2));
        zza("/mraidLoaded", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) this.zzdpl);
        zzab zzab = r1;
        zzab zzab2 = new zzab(this.zzcct.getContext(), this.zzcct.zztl(), this.zzcct.zzuc(), zzt, zzkf, zzb2, zzn, zzw2, this.zzccn);
        zza("/open", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzab);
        zza("/precache", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) new zzaoc());
        zza("/touch", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzd.zzcbm);
        zza("/video", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzd.zzcbp);
        zza("/videoMeta", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) zzd.zzcbq);
        if (zzbt.zzfh().zzq(this.zzcct.getContext())) {
            zza("/logScionEvent", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) new zzz(this.zzcct.getContext()));
        }
        if (zzx2 != null) {
            zza("/setInterstitialProperties", (com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>) new com.google.android.gms.ads.internal.gmsg.zzw(zzx2));
        }
        this.zzbgt = zzkf;
        this.zzccs = zzn;
        this.zzcbc = zzb2;
        this.zzccr = zzt;
        this.zzccm = zzw2;
        this.zzcco = zzyo;
        this.zzcck = zzx2;
        this.zzdpg = z;
    }

    public final void zza(String str, com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof> zzt) {
        synchronized (this.mLock) {
            List list = this.zzcou.get(str);
            if (list == null) {
                list = new CopyOnWriteArrayList();
                this.zzcou.put(str, list);
            }
            list.add(zzt);
        }
    }

    public final void zza(String str, com.google.android.gms.common.util.zzt<com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof>> zzt) {
        synchronized (this.mLock) {
            List<com.google.android.gms.ads.internal.gmsg.zzt> list = this.zzcou.get(str);
            if (list != null) {
                ArrayList arrayList = new ArrayList();
                for (com.google.android.gms.ads.internal.gmsg.zzt zzt2 : list) {
                    if (zzt.apply(zzt2)) {
                        arrayList.add(zzt2);
                    }
                }
                list.removeAll(arrayList);
            }
        }
    }

    public final void zza(boolean z, int i) {
        zza(new AdOverlayInfoParcel((!this.zzcct.zzud() || this.zzcct.zzty().zzvl()) ? this.zzbgt : null, this.zzccs, this.zzccr, this.zzcct, z, i, this.zzcct.zztl()));
    }

    public final void zza(boolean z, int i, String str) {
        boolean zzud = this.zzcct.zzud();
        zza(new AdOverlayInfoParcel((!zzud || this.zzcct.zzty().zzvl()) ? this.zzbgt : null, zzud ? null : new zzaok(this.zzcct, this.zzccs), this.zzcbc, this.zzccr, this.zzcct, z, i, str, this.zzcct.zztl()));
    }

    public final void zza(boolean z, int i, String str, String str2) {
        boolean zzud = this.zzcct.zzud();
        zza(new AdOverlayInfoParcel((!zzud || this.zzcct.zzty().zzvl()) ? this.zzbgt : null, zzud ? null : new zzaok(this.zzcct, this.zzccs), this.zzcbc, this.zzccr, this.zzcct, z, i, str, str2, this.zzcct.zztl()));
    }

    public final void zzag(boolean z) {
        this.zzdpg = z;
    }

    public final void zzb(int i, int i2) {
        if (this.zzccn != null) {
            this.zzccn.zzb(i, i2);
        }
    }

    public final void zzb(String str, com.google.android.gms.ads.internal.gmsg.zzt<? super zzaof> zzt) {
        synchronized (this.mLock) {
            List list = this.zzcou.get(str);
            if (list != null) {
                list.remove(zzt);
            }
        }
    }

    public final boolean zzfz() {
        boolean z;
        synchronized (this.mLock) {
            z = this.zzavq;
        }
        return z;
    }

    public final void zzk(zzaof zzaof) {
        this.zzcct = zzaof;
    }

    public final void zznj() {
        synchronized (this.mLock) {
            this.zzdpg = false;
            this.zzavq = true;
            zzaly.zzdjt.execute(new zzaoh(this));
        }
    }

    public final zzw zzun() {
        return this.zzccm;
    }

    public final boolean zzuo() {
        boolean z;
        synchronized (this.mLock) {
            z = this.zzdph;
        }
        return z;
    }

    public final ViewTreeObserver.OnGlobalLayoutListener zzup() {
        ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener;
        synchronized (this.mLock) {
            onGlobalLayoutListener = this.zzdpi;
        }
        return onGlobalLayoutListener;
    }

    public final ViewTreeObserver.OnScrollChangedListener zzuq() {
        ViewTreeObserver.OnScrollChangedListener onScrollChangedListener;
        synchronized (this.mLock) {
            onScrollChangedListener = this.zzdpj;
        }
        return onScrollChangedListener;
    }

    public final boolean zzur() {
        boolean z;
        synchronized (this.mLock) {
            z = this.zzdpk;
        }
        return z;
    }

    public final void zzut() {
        zzagq zzagq = this.zzaop;
        if (zzagq != null) {
            WebView webView = this.zzcct.getWebView();
            if (ViewCompat.isAttachedToWindow(webView)) {
                zza((View) webView, zzagq, 10);
                return;
            }
            zzus();
            this.zzdpq = new zzaoj(this, zzagq);
            this.zzcct.getView().addOnAttachStateChangeListener(this.zzdpq);
        }
    }

    public final void zzuu() {
        synchronized (this.mLock) {
            this.zzdpk = true;
        }
        this.zzdpp++;
        zzux();
    }

    public final void zzuv() {
        this.zzdpp--;
        zzux();
    }

    public final void zzuw() {
        this.zzdpo = true;
        zzux();
    }

    public final zzapy zzuy() {
        return this.zzdpm;
    }

    /* access modifiers changed from: package-private */
    public final /* synthetic */ void zzuz() {
        this.zzcct.zzui();
        com.google.android.gms.ads.internal.overlay.zzd zztw = this.zzcct.zztw();
        if (zztw != null) {
            zztw.zznj();
        }
        if (this.zzdpf != null) {
            this.zzdpf.zzdc();
            this.zzdpf = null;
        }
    }
}
